home *** CD-ROM | disk | FTP | other *** search
- Path: pegasus.montclair.edu!harmon
- From: harmon@pegasus.montclair.edu (Derek Harmon)
- Newsgroups: comp.lang.c
- Subject: Re: Data Conversions
- Date: 8 Feb 1996 20:28:13 -0500
- Organization: Montclair State University
- Message-ID: <harmon.823829188@pegasus.montclair.edu>
- References: <4fbfqp$fsk@madeline.INS.CWRU.Edu>
- NNTP-Posting-Host: pegasus.montclair.edu
- X-Newsreader: NN version 6.5.0 #68 (NOV)
-
- ** Quoting a message by <mab22@po.CWRU.Edu> dated <8-Feb-1996>:
-
- > Are there any pre-existing routines to do data conversions?
- ... [convert type A to type B, type A in Visual BASIC to type Z used only
- by Martian computers, etc] ... :)
-
- > void Translate(long dataType,long length,char *inData,
- long outDataType, long outLength,char *outData);
-
- > Unfortunately, it's either suffered speed drawbacks or become very
- > complicated in terms of adding data types. (One function is needed for
- > every type of datatype conversion)
-
- That's understandable, as Translate() would be too-general to be implemented
- for all data types, and a switch statement would be slow to dispatch amongst
- many specific subfunctions. I'd suggest calling the single functions with a
- uniform API, collecting them all into one .H to be kept by your terminal in
- hardcopy, and making a library of them:
-
- void XXXtoYYY([best fit type of XXX] *dest, const [best fit type of YYY] *src);
-
- Each XXXtoYYY() would know the lengths of the datum it would convert. It
- is already a commonality in many C functions (strcpy, strcat, etc) to have
- dest before src in the parameter listing, e.g. the shorthand, dest <- src.
-
- > Surely, somebody has run into this problem before and solved it?
-
- People run into this problem everyday, then they take their coffee
- breaks. :)
-
- > written C programs to deal with them and created a nice set of
- > public-domain translation routines, right?
- ^^^^^^^^^^^^^
- There's too much $$$ to be made for such libraries. Data formats are
- afflicted by the curse of the Tower of Babble. There are no standards,
- there are only standardization efforts (cf. FITS).
-
- -- Stone
- --
- [ SSS TTT OOO N N EEE ] Derek Harmon (a.k.a. Stonelight)
- [ S_ T O O NN N E_ ] E-Mail: harmon@pegasus.montclair.edu
- [ S T O O N NN E ] Computer Science Undergrad at
- [ SSS T OOO N N EEE ] Montclair State University, NJ
- (My views are entirely my own, nobody else is this creative :)
-
-
-